package com.ruoyi.material.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.material.domain.MateEvaluate;
import com.ruoyi.material.domain.MaterialManufactuter;
import com.ruoyi.material.mapper.MateManufactuterMapper;
import com.ruoyi.material.service.MateManufactuterService;
import com.ruoyi.mtAudit.domain.MtAudit;
import com.ruoyi.mtAudit.mapper.MtAuditMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author
 * @Version 1.0
 */
@Service
public class MateManufactuterServiceImpl implements MateManufactuterService {

    @Autowired
    MateManufactuterMapper mateManufactuterMapper;
    @Autowired
    MtAuditMapper mtAuditMapper;

    @Override
    public int insertMateManufacturer(MaterialManufactuter materialManufactuter) {
        return mateManufactuterMapper.insertMateManufacturer(materialManufactuter);
    }

    @Override
    public List<MaterialManufactuter> selectMateManufactuter(MaterialManufactuter materialManufactuter) {
        return mateManufactuterMapper.selectMateManufactuter(materialManufactuter);
    }

    @Override
    public int updateMateManufacturer(MaterialManufactuter materialManufactuter) {
        return mateManufactuterMapper.updateMateManufacturer(materialManufactuter);
    }

    @Override
    public int insertEvaluate(MateEvaluate mateEvaluate) {
        int a = mateManufactuterMapper.insertEvaluate(mateEvaluate);
        MtAudit mtAudit = new MtAudit();
        mtAudit.setOrderId(mateEvaluate.getEvaluateId());
        mtAudit.setCompanyId(SecurityUtils.getLoginUser().getCompanyId());
        mtAudit.setOrderType("4");
        mtAudit.setAuditStatus("0");
        mtAudit.setZjName(mateEvaluate.getApplyName());
        mtAudit.setAuditBy(SecurityUtils.getLoginUser().getNickName());
        mtAuditMapper.insertMtAudit(mtAudit);
        return a;
    }

    @Override
    public MateEvaluate selectEdit(Map<String, Object> resMap) {
        return mateManufactuterMapper.selectEdit(resMap);
    }


    @Override
    public int updateAdvice(MateEvaluate mateEvaluate) {
        return mateManufactuterMapper.updateAdvice(mateEvaluate);
    }



    @Override
    public List<MateEvaluate> selectEvaluateList(MateEvaluate mateEvaluate) {
        return mateManufactuterMapper.selectEvaluateList(mateEvaluate);
    }


}
